﻿Ext.data.MemoryProxy = Ext.extend(Ext.data.ClientProxy, {

    constructor: function (config) {
        Ext.data.MemoryProxy.superclass.constructor.call(this, config);
        this.setReader(this.reader);
    },

    read: function (operation, callback, scope) {
        var reader = this.getReader(),
            result = reader.read(this.data); // 直接读取this.data的数据

        Ext.apply(operation, {
            resultSet: result
        });

        operation.setCompleted();

        if (typeof callback == 'function') {
            callback.call(scope || this, operation);
        }
    },

    clear: Ext.emptyFn
});

Ext.data.ProxyMgr.registerType('memory', Ext.data.MemoryProxy);